﻿using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Kiiro.Common.Interfaces;
using Kiiro.Common.Entities;
using Kiiro.Common.Utility;

namespace Kiiro.Common.Entities
{
    [Serializable]
    public class ValidationMessage:BaseEntity, IEntity
    {		
        #region Constructor

		private ValidationMessage() {
		}

        public ValidationMessage(ValidationSeverity severity, string message)
        {
			Severity = severity;
			Message = message;
		}

		#endregion

		#region Properties

        private ValidationSeverity severity;
        private string message;

        public ValidationSeverity Severity
        {
            get { return severity; }
            set { severity = value; }
        }
        
        public string Message
        {
            get { return message; }
            set { message = value; }
        }

		#endregion


        #region Public Methods

        internal static ValidationMessage GetNew()
        {
            return new ValidationMessage();
        }

        internal static ValidationMessage GetNew(ValidationSeverity severity, string message)
        {
            return new ValidationMessage(severity, message);
        }

        #endregion

        #region IEntity Members


        public new bool IsValid()
        {
            return AllValidationErrors().Count == 0;
        }

        public new List<ValidationMessage> AllValidationErrors()
        {
            List<ValidationMessage> allErrors = new List<ValidationMessage>();

            allErrors.AddRange(base.AllValidationErrors());

            return allErrors;

        }

        public new void ClearValidationMessages()
        {
            base.ClearValidationMessages();
        }

        #endregion
    }
}

/*************************************************************************
 * 
 * $Log: /Internal Projects/Kiiro/Kiiro.Common/Entities/ValidationMessage.cs $
 * 
 * 3     17/08/09 10:38a Camerons
 * Added check-in comments section
 * 
 ************************************************************************/